<template>
  <div>
    <el-button type="text" icon="el-icon-arrow-left" @click="goBack">返回</el-button>
    <div class="content-box">
      <h2 class="title">{{content.title}}</h2>
      <h2 class="time">{{content.publishTime}}</h2>
      <div class="word-content" v-html="content.content"></div>
    </div>
  </div>

</template>

<script>
import {noticeContentObj} from '@/service/get-data'
import {Button} from 'element-ui'
export default {
  components: {
    elButton: Button
  },
  data () {
    return {
      content: {}
    }
  },
  methods: {
    goBack () {
      this.$router.push({name: 'Notice', params: {type: this.type}})
      // this.$router.go(-1)
    },
    // 获取帮助内容
    async fetchContent () {
      let res = await noticeContentObj(this.contentId)
      if (res.data.resultCode && res.data.resultCode === 2000) {
        res = res.data
        this.content = res.data
      }
    }
  },
  computed: {
    type () {
      return this.$route.params.type
    },
    contentId () {
      return this.$route.params.id
    }
  },
  // mounted () {
  //   this.fetchContent()
  // },
  activated () {
    this.fetchContent()
  }
}
</script>

<style lang="scss" scoped>
  .content-box{
    border: 1px solid #f0f0f0;
    padding: 14px 12px;
    font-size: 14px;
    color: #666666;
    line-height: 20px;
    .title{
      text-align: center;
      color: #000;
      font-size: 16px;
      line-height: 25px;
    }
    .time{
      text-align: center;
    font-size: 12px;
    }
  }
</style>
<style>
  .word-content img{
    width: 100%;
  }
</style>
